package com.vca.admin.controller;

import com.vca.common.result.CommonResult;
import com.vca.service.service.ExportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

/**
 * @ClassName ExportTestController
 * @Deacription TODO
 * @Author Jamie
 * @Date 2023/11/23 13:32
 **/
@RestController
@RequestMapping("api/admin/exportTest")
public class ExportTestController {

    @Autowired
    private ExportService exportService;

    @GetMapping("/testDetailClient")
    public CommonResult<Map<String, String>> testDetailClient(@RequestParam String dateLimit, HttpServletResponse response){
        try {
            exportService.testDetailClient(dateLimit, "detailByClient.xlsx",response);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return CommonResult.success();
    }



}
